---
description:
  GraphQL Inspector is a set of tools to help you better maintain and improve GraphQL API as well as
  GraphQL consumers.
---

import { Callout } from '@theguild/components'

# Getting Started and Installation

You can choose one to more of the following ways to use GraphQL Inspector.

## GitHub Action

1. Visit [GraphQL Inspector](https://github.com/marketplace/actions/graphql-inspector) on GitHub
   Marketplace.
2. Follow the installation instructions provided in the ["GitHub Action"](./products/action)
   chapter.

## CLI

The Command Line Tool provides all the features of GraphQL Inspector and can be installed with a
single command:

Install using:

```sh npm2yarn
npm i --global @graphql-inspector/cli graphql
```

<Callout type="info">
  We added `graphql` package as a peer dependency to make sure you have the right version installed.
</Callout>

### CLI Usage

```sh
graphql-inspector --help
```

Options:

| Command              | Description         | More      |
| -------------------- | ------------------- | --------- |
| --version            | Show version number | [boolean] |
| -r, --require        | Require modules     | [array]   |
| -t, --token          | Access Token        | [string]  |
| -h, --header         | Http Header         | [array]   |
| --hl, --left-header  | Http Header - Left  | [array]   |
| --hr, --right-header | Http Header - Right | [array]   |
| --help               | Show help           | [boolean] |

## CLI for CI

Works similar to regular CLI but every feature is pluggable to keep the size as low as possible.

Install using:

```sh npm2yarn
npm i --global @graphql-inspector/ci
```

### Commands

Every command is installable through a package.

- diff - `@graphql-inspector/diff-command`
- validate - `@graphql-inspector/validate-command`
- coverage - `@graphql-inspector/coverage-command`
- similar - `@graphql-inspector/similar-command`
- introspect - `@graphql-inspector/introspect-command`
- serve - `@graphql-inspector/serve-command`

<Callout type="info">
  Please take a look at ["Continuous Integration"](./products/ci) chapter.
</Callout>

### CLI for CI - Usage

```sh
graphql-inspector --help
```

## Programmatic API

GraphQL Inspector comes with a programmatic API, here is how to use the Core package.

Install using your favorite package manager:

```sh npm2yarn
npm i @graphql-inspector/core
```

### Programmatic API - Usage

```ts
import { diff, validate, coverage, ... } from '@graphql-inspector/core'
```

## Docker

GraphQL Inspector is also available on Docker.

```sh
docker run graphql-hive/graphql-inspector --help
```

Bind volumes to `/app` for working with local files, for example:

```sh
docker run -v $PWD:/app graphql-hive/graphql-inspector graphql-inspector diff old.graphql new.graphql
```

To run commands interactively inside of the container, use the following:

```sh
docker run -it graphql-hive/graphql-inspector
```
